<!-- LIST PAGE -->
<div class="container" id="list-container">
    <div class="row">
        <div class="col-md-8">
            <div class="component">
                <div class="title">
                    <div class="btn-group btn-group-sm pull-right">
                        <div class="btn-group btn-group-sm">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                    translate="GENERAL.ACTION.SHOW-RESULTS" translate-value-size="{{'GENERAL.RESULT-SIZES.' + filter.resultSize | translate}}">
                                &nbsp;
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                            	<li ng-repeat="resultSize in config.filter.resultSizes"><a href="" ng-click="filter.setResultSize(resultSize)">{{'GENERAL.RESULT-SIZES.' + resultSize.toString() | translate}}</a></li>
                            </ul>
                        </div>
                        <button type="button" class="btn btn-default" ng-click="filter.toggleOrder()">
                        	<i class="glyphicon" ng-class="{'glyphicon-sort-by-attributes': filter.order == 'asc', 'glyphicon-sort-by-attributes-alt': filter.order == 'desc'}"></i>
                        </button>
                    </div>
                    <div class="btn-group btn-group-sm pull-right">
                    	<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
                                translate="GENERAL.ACTION.SORT-BY" translate-value-sort="{{filter.sort.name | translate}}">
                            &nbsp;
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                           <li ng-repeat="sort in filter.sortObjects"><a href="" ng-click="filter.setSort(sort)">{{sort.name | translate}}</a></li>
                        </ul>
                    </div>
                    <div class="btn-group btn-group-sm pull-right">
                        <a class="btn btn-default" role="button"
                           title="{{'GENERAL.ACTION.REFRESH-LIST' | translate}}"
                           ng-click="filter.refresh();">
                            <i class="glyphicon glyphicon-refresh"></i>
                        </a>
                    </div>
                    <div class="pull-right loading" ng-show="filter.loading">
                    	<i class="glyphicon glyphicon-refresh"></i>
                    </div>

                    <h2 translate="PROCESS-INSTANCES.TITLE"></h2>
                </div>

                <div class="grid-wrapper" id="process-instances">
                    <div class="grid-message" ng-if="processInstances.size > 0">
                         <span>{{'PROCESS-INSTANCES.LIST-MESSAGE' | translate:processInstances}}</span>
                    </div>
                     <div class="grid-message" ng-if="processInstances.size == 0">
                        <span>{{'PROCESS-INSTANCES.LIST-MESSAGE-EMPTY' | translate}}</span>
                    </div>
                    <div ng-grid="gridInstances" class="gridStyle" ng-if="gridInstances && processInstances.data"/>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="component tip-left">
                <div class="title">
                    <div class="btn-group btn-group-sm pull-right" ng-show="filter.supportedProperties.length > 0">
                        <button type="button" class="btn btn-default" data-toggle="dropdown">
                            <i class="glyphicon glyphicon-plus"></i>
                        </button>
                        <ul class="dropdown-menu">
                            <li ng-repeat="prop in filter.supportedProperties"><a href="" ng-click="addFilterProperty(prop)">{{prop.name | translate}}</a></li>
                        </ul>
                    </div>
                    <div class="pull-right">
                        <a class="action" ng-click="clearFilters()" translate="GENERAL.ACTION.CLEAR-FILTERS"></a>
                    </div>
                    <h2 translate="GENERAL.TITLE.FILTERS"></h2>
                </div>
                <div class="section">
                    <div class="subtitle"><label translate="PROCESS-INSTANCES.FILTER.PROCESS-DEFINITION"></label> </div>
                    <div>
                        <select ui-select2
                                data-placeholder="{{'PROCESS-INSTANCES.FILTER.ALL-PROCESS-DEFINITIONS' | translate}}"
                         		ng-model="filter.processDefinition"
                         		ng-change="processDefinitionFilterChanged()"
                         		style="min-width:250px">
                            <option value=""></option>
                         	<option value="-1">{{'PROCESS-INSTANCES.FILTER.ALL-PROCESS-DEFINITIONS' | translate}}</option>
                         	<option ng-title="123" ng-repeat="processDefinition in processDefinitionsCache.data" value="{{processDefinition.id}}">{{processDefinition.name ? processDefinition.name : processDefinition.key}} (v{{processDefinition.version}})</option>
                         </select>
                    </div>
                </div>
                <div class="section" ng-if="filter.properties.finished !== undefined">
                    <div class="subtitle"><label for="filter-finished" translate="PROCESS-INSTANCES.FILTER.STATUS"></label> </div>
                    <div class="input-group input-group-sm" id="filter-state">
                       <div class="btn-group btn-group-sm">
                        <button type="button" id="filter-finished" class="btn btn-default dropdown-toggle form-control" data-toggle="dropdown">
                            <span class="pull-right">
                                <span class="caret"></span>
                            </span>
                            {{filter.getLabelForOption('finished') | translate}}
                        </button>
                        <ul class="dropdown-menu">
                            <li ng-repeat="state in filter.options.finished"><a href="" ng-click="filter.selectOption('finished', state)">{{state.name | translate}}</a></li>
                        </ul>
                    </div>
                    </div>
                </div>
                <div class="section" ng-if="filter.properties.processBusinessKey!== undefined">
                    <div class="subtitle"><label for="filter-processBusinessKey" translate="PROCESS-INSTANCES.FILTER.BUSINESS-KEY"></label> </div>
                    <div class="input-group input-group-sm">
                        <input id="filter-processBusinessKey" type="text" class="form-control" value="" ng-model="filter.properties.processBusinessKey" ng-change="filter.refreshDelayed()">
                    </div>
                </div>
                <div class="section" ng-if="filter.properties.superProcessInstanceId!== undefined">
                    <div class="subtitle"><label for="filter-superProcessInstanceId" translate="PROCESS-INSTANCES.FILTER.SUPER-PROCESS-INSTANCE-ID"></label> </div>
                    <div class="input-group input-group-sm">
                        <input id="filter-superProcessInstanceId" type="text" class="form-control" value="" ng-model="filter.properties.superProcessInstanceId" ng-change="filter.refreshDelayed()">
                    </div>
                </div>
                <div class="section" ng-if="filter.properties.startedBefore !== undefined">
                  <div class="subtitle"><label for="filter-startedBefore" translate="PROCESS-INSTANCES.FILTER.STARTED-BEFORE"></label> </div>
               	  <div class="input-group input-group-sm">
               	  	<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
	              	<input id="filter-startedBefore" type="text" class="form-control" ng-model="filter.properties.startedBefore"
                           ng-change="filter.refreshDelayed()"
                           datepicker-popup="dd/MM/yyyy"
                           is-open="startedBeforePicker.isOpen" ng-click="startedBeforePicker.isOpen=true"/>
	              </div>
	            </div>
                <div class="section" ng-if="filter.properties.startedAfter !== undefined">
	              <div class="subtitle"><label for="filter-startedAfter" translate="PROCESS-INSTANCES.FILTER.STARTED-AFTER"></label> </div>
               	  <div class="input-group input-group-sm">
               	  	<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
	              	<input id="filter-startedAfter" type="text" class="form-control" ng-model="filter.properties.startedAfter"
                           ng-change="filter.refreshDelayed()"
                           datepicker-popup="dd/MM/yyyy"
                           is-open="startedAfterPicker.isOpen" ng-click="startedAfterPicker.isOpen=true"/>
	              </div>
	            </div>
	            <div class="section" ng-if="filter.properties.finishedBefore !== undefined">
                  <div class="subtitle"><label for="filter-finishedBefore" translate="PROCESS-INSTANCES.FILTER.ENDED-BEFORE"></label> </div>
               	  <div class="input-group input-group-sm">
               	  	<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
	              	<input id="filter-finishedBefore" type="text" class="form-control" ng-model="filter.properties.finishedBefore"
                           ng-change="filter.refreshDelayed()"
                           datepicker-popup="dd/MM/yyyy"
                           is-open="finishedBeforePicker.isOpen" ng-click="finishedBeforePicker.isOpen=true"/>
	              </div>
	            </div>
                <div class="section" ng-if="filter.properties.finishedAfter !== undefined">
	              <div class="subtitle"><label for="filter-finishedAfter" translate="PROCESS-INSTANCES.FILTER.ENDED-AFTER"></label> </div>
               	  <div class="input-group input-group-sm">
               	  	<span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
	              	<input id="filter-finishedAfter" type="text" class="form-control" ng-model="filter.properties.finishedAfter"
                           ng-change="filter.refreshDelayed()"
                           datepicker-popup="dd/MM/yyyy"
                           is-open="finishedAfterPicker.isOpen" ng-click="finishedAfterPicker.isOpen=true"/>
	              </div>
	            </div>

	            <div class="section clearfix" ng-repeat="varFilter in filter.properties.variables">
	              <div class="seperator" ng-if="$index > 0"></div>
	              <div class="subtitle"><label translate="PROCESS-INSTANCES.FILTER.VARIABLE"></label> </div>
               	  <div class="inline-button input-group-sm">
	              		<div class="pull-right btn-group">
	                        <button ng-disabled="varFilter.type.id == 'boolean'" tabindex="-1" type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
	                             {{varFilter.operator.sign}} <i class="caret"></i>
	                        </button>
	                        <ul class="dropdown-menu">
	                            <li><a href="" ng-click="setVariableFilterOperator(varFilter, operator)" ng-repeat="operator in variableFilterOperators">{{operator.name}}</a></li>
	                        </ul>
	                    </div>
	              		<input id="filter-variable-name-{{$index}}" type="text" class="form-control" ng-model="varFilter.name" ng-change="filter.refreshDelayed()" placeholder="{{'PROCESS-INSTANCES.FILTER.VARIABLE-NAME' | translate}}" />
	              </div>
               	  <div class="inline-button wide input-group-sm" >
	              		<div class="pull-right btn-group">
	                        <button tabindex="-1" ng-disabled="varFilter.operator.id == 'like'" type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
	                           {{varFilter.type.name}} <i class="caret"></i>
	                        </button>
	                        <ul class="dropdown-menu">
	                            <li><a href="" ng-click="setVariableFilterType(varFilter, type)" ng-repeat="type in variableFilterTypes" >{{type.name}}</a></li>
	                        </ul>
	                    </div>
	              		<input ng-if="varFilter.type.id != 'date' && varFilter.type.id != 'boolean'" id="filter-variable-value-{{$index}}" type="text" class="form-control" ng-model="varFilter.value" ng-change="filter.refreshDelayed()" placeholder="{{'PROCESS-INSTANCES.FILTER.VARIABLE-VALUE' | translate}}" />
	              		<input ng-if="varFilter.type.id == 'date'" id="filter-variable-value-{{$index}}" type="text" class="form-control" ng-model="varFilter.value"
                               ng-change="filter.refresh()"
                               datepicker-popup="dd/MM/yyyy"
                               is-open="varValuePicker.isOpen" ng-click="varValuePicker.isOpen=true"/>
	              		<div class="checkbox" ng-if="varFilter.type.id == 'boolean'">
						    <label>
						      <input type="checkbox" ng-change="filter.refresh()" ng-model="varFilter.value">{{'PROCESS-INSTANCES.FILTER.VARIABLE-BOOLEAN-VALUE' | translate:varFilter}}
						    </label>
  						</div>
	              </div>
	            </div>
	            <div class="section" ng-if="filter.properties.tenantIdLike !== undefined">
                    <div class="subtitle"><label for="filter-tenantId" translate="PROCESS-INSTANCES.FILTER.TENANT-ID"></label> </div>
                    <div class="input-group input-group-sm">
                        <input id="filter-tenantId" type="text" class="form-control" value="" ng-model="filter.properties.tenantIdLike" ng-change="filter.refreshDelayed()">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
